﻿using System.ComponentModel;

namespace Vtron.HipcConfigurationTools.Domain
{
    /// <summary>
    /// 系统状态信息
    /// </summary>
    public class SystemStatusInfo : INotifyPropertyChanged
    {
        #region Fields

        private float temperature;
        private int runTime;
        private string runState;
        private float cpuLoad;
        private int freeMem; 

        #endregion

        #region Properties

        /// <summary>
        /// 当前温度
        /// </summary>
        public float Temperature
        {
            get { return temperature; }
            set
            {
                temperature = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("Temperature"));
                }
            }
        }

        /// <summary>
        /// 系统运行时间
        /// </summary>
        public int RunTime
        {
            get { return runTime; }
            set
            {
                runTime = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("RunTime"));
                }
            }
        }

        /// <summary>
        /// 运行状态
        /// </summary>
        public string RunState
        {
            get { return runState; }
            set
            {
                runState = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("RunState"));
                }
            }
        }

        /// <summary>
        /// CPU占用率
        /// </summary>
        public float CpuLoad
        {
            get { return cpuLoad; }
            set
            {
                cpuLoad = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("CpuLoad"));
                }
            }
        }

        /// <summary>
        /// 空余内存
        /// </summary>
        public int FreeMem
        {
            get { return freeMem; }
            set
            {
                freeMem = value;
                if (PropertyChanged != null)
                {
                    PropertyChanged.Invoke(this, new PropertyChangedEventArgs("FreeMem"));
                }
            }
        } 

        #endregion

        public event PropertyChangedEventHandler PropertyChanged;
    }
}
